/**
 *====================================================
* 文件名称: PickupExchangeContainerBulkstockServiceImpl.java
 * 修订记录：
  * No    日期				作者(操作:具体内容)
  * 1.    2016年03月21日	chenxy(创建:创建文件)
  *====================================================
  * 类描述：(说明未实现或其它不应生成javadoc的内容)
  */
package com.yuexunit.finance.project.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.yuexunit.finance.project.entity.PickupApplicationEntity;
import com.yuexunit.finance.project.entity.PickupExchangeContainerBulkstockEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.persist.PersistUtil;

/**
 * @ClassName: PickupExchangeContainerBulkstockServiceImpl
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author chenxy
 * @date 2016年03月21日 09:47:55
 */
@Implements(PickupExchangeContainerBulkstockService.class)
public class PickupExchangeContainerBulkstockServiceImpl implements PickupExchangeContainerBulkstockService {

	@Override
	public Long createPickupExchangeContainerBulkstock(PickupExchangeContainerBulkstockEntity entity) {
		PersistUtil.insert(entity);
		return entity.getContainerBulkstockId();
	}

	@Override
	public void renovatePickupExchangeContainerBulkstock(PickupExchangeContainerBulkstockEntity persist) {
		PersistUtil.update(persist);
	}

	@Override
	public PickupExchangeContainerBulkstockEntity inquirePickupExchangeContainerBulkstockDetail(Long containerBulkstockId) {
		PickupExchangeContainerBulkstockEntity entity = PersistUtil.get(PickupExchangeContainerBulkstockEntity.class, containerBulkstockId);
		return entity;
	}

	@Override
	public List<PickupExchangeContainerBulkstockEntity> inquirePickupExchangeContainerBulkstockList(PickupApplicationEntity pickup) {
		DetachedCriteria criteria = DetachedCriteria.forClass(PickupExchangeContainerBulkstockEntity.class);
		criteria.add(Restrictions.eq("pickupId", pickup.getPickupId()));
		return PersistUtil.get(criteria);
	}

	@Override
	public List<PickupExchangeContainerBulkstockEntity> inquirePickupExchangeContainerBulkstockList(Long[] containerIds) {
		DetachedCriteria criteria = DetachedCriteria.forClass(PickupExchangeContainerBulkstockEntity.class);
		criteria.add(Restrictions.in("containerId", containerIds));
		return PersistUtil.get(criteria);
	}

	@Override
	public List<PickupExchangeContainerBulkstockEntity> inquirePickupExchangeContainerBulkstockList(Long containerId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(PickupExchangeContainerBulkstockEntity.class);
		criteria.add(Restrictions.eq("containerId", containerId));
		return PersistUtil.get(criteria);
	}

}
